% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/question.R
\name{normalize_qids}
\alias{normalize_qids}
\title{Normalize historical \code{question_id}s}
\usage{
normalize_qids(ids, ttable)
}
\arguments{
\item{ids}{NumericVector of \code{question_id}s.}

\item{ttable}{\code{question_id} translation table (\emph{e.g.},
the question table).}
}
\description{
Given a vector of \code{question_id}s, \code{normalize_qids}
replaces the historical \code{question_id}s with the analogous
contemporary \code{question_id}s where there's a match based on
\code{ttable}.
}
\details{
\code{normalize_qids} is fairly inflexible and is meant to
    work directly with the question table. Thus, \code{ttable}
    requires two columns: \code{name} and \code{question_id}. We
    determine whether an historical \code{question_id} has a
    matching contemporary \code{question_id} by checking the root
    tag --- the portion of the tag after removing the \code{v\\d}
    suffix.
}
\section{Warning}{
 We are currently not checking whether matching
    historical and contemporary \code{question_id}s have the same
    \code{K} (\emph{i.e.}, number of answer categories). This is
    mostly because our information on \code{K} is fairly
    incomplete; plus, there are a number of variables such as
    \code{v3lgbicam} which diverge from contemporary and yet we
    still want to merge them together.

    This is something that can be improved in the future.
}

\examples{
ttable <- data.frame(question_id = 1:3,
                     name = c("v2clacfree", "v3clacfree", "v3strenadm"),
                     stringsAsFactors = FALSE)

normalize_qids(1:3, ttable)

}
